﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using InteControlSys.VehicleControlService;
using System.ComponentModel;
using Xceed.Wpf.Toolkit.PropertyGrid.Attributes;
using System.Windows.Input;
using Microsoft.Expression.Interactivity.Core;
using System.Windows;


namespace InteControlSys.ViewModel
{
    public class TruckNodeViewModel : NodeViewModel
    {
        #region 基本属性
        [Category("基本")]
        [DisplayName("订单号")]
        [PropertyOrder(1)]
        public string PurchaseOrderNo
        {
            get { return truck.PurchaseOrderNo; }
        }

        [Category("基本")]
        [DisplayName("行号")]
        [PropertyOrder(2)]
        public string PurchaseOrderLineNo
        {
            get { return truck.PurchaseOrderLineNo; }
        }

        [Category("基本")]
        [DisplayName("业务类型")]
        [PropertyOrder(3)]
        public string BusinessType
        {
            get { return truck.BusinessType; }
        }
        
        [Category("基本")]
        [DisplayName("车牌")]
        [PropertyOrder(4)]
        public string ConveyanceNo
        {
            get { return truck.ConveyanceNo; }
        }
      
        [Category("基本")]
        [DisplayName("驾驶员")]
        [PropertyOrder(5)]
        public string DriverName
        {
            get { return truck.DriverName; }
        }
        
        [Category("基本")]
        [DisplayName("手机号")]
        [PropertyOrder(6)]
        public string PhoneNO
        {
            get { return truck.PhoneNO; }
        }

        [Category("基本")]
        [DisplayName("物料")]
        [PropertyOrder(7)]
        public string MaterialName
        {
            get { return truck.MaterialName; }
        }
        
        [Category("基本")]
        [DisplayName("承运商")]
        [PropertyOrder(8)]
        public string SupplierName
        {
            get { return truck.SupplierName; }
        }

        [Category("基本")]
        [DisplayName("库存地")]
        [PropertyOrder(9)]
        public string StoreRoomCode
        {
            get { return truck.StoreRoomCode; }
        }

        [Category("基本")]
        [DisplayName("计划卸料")]
        [PropertyOrder(10)]
        public string PlanStoragePlaceCode
        {
            get { return truck.PlanStoragePlaceCode; }
        }

        [Category("基本")]
        [DisplayName("描述")]
        [PropertyOrder(11)]
        public string LastProcessLogDescription
        {
            get { return truck.LastProcessLogDescription; }
        }

        [Category("基本")]
        [DisplayName("检验批号")]
        [PropertyOrder(12)]
        public string QualityVoucherNo
        {
            get { return truck.QualityVoucherNo; }
        }

        [Category("基本")]
        [DisplayName("检斤号")]
        [PropertyOrder(13)]
        public string WeightVoucherNo
        {
            get { return truck.WeightVoucherNo; }
        }

        [Category("基本")]
        [DisplayName("接车号")]
        [PropertyOrder(14)]
        public string ReceiveRecordNo
        {
            get { return truck.ReceiveRecordNo; }
        }
        #endregion

        private TransportInfo truck;
        public TransportInfo Truck
        {
            get { return truck; }
            set
            {
                truck = value;
                this.NotifyChanged("Truck");
            }
        }
        

        public TruckNodeViewModel(TransportInfo transportInfo)
        {
            this.Name = transportInfo.ConveyanceNo;
            this.Parent = null;
            this.IsExpanded = true;
            this.NodeType = "TruckNodeViewModel";
            this.Truck = transportInfo;
        }
        //public TruckNodeViewModel(VehicleInfo info,ShipDetailInfo shipinfo)
        //{
        //    this.Name = info.VehicleID;
        //    this.NodeType = "TruckNodeViewModel";
        //    this.TruckType = info.VehicleType;
        //    this.Carrier = info.Carrier;
        //    if (shipinfo != null)
        //        this.ShipDetailCode = shipinfo.ShipDetailCode;

        //}
        public override Uri GetMyIcon()
        {
            return new Uri("../Resources/Images/truck.png", UriKind.RelativeOrAbsolute);
        }               



    }
}
